package cn.lfy.studentmanager.dao;

import java.util.List;


import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


import cn.lfy.studentmanager.domain.Student;

public interface StudentDao {
	@Insert("INSERT INTO student(name,number,sex,cid,sid,passwd) "
			+ "VALUES(#{name}, #{number}, #{sex}, #{cid}, #{sid}, #{passwd})")
	@Options(useGeneratedKeys=true, keyProperty="id", keyColumn="id")
	boolean add(Student student);
	

	@Delete("DELETE FROM student WHERE id =#{id}")
	boolean delete(int id);
	
	
	@Select("SELECT *FROM student WHERE id =#{id}")
	Student query(int id);
	//查询的是单个学生Student query(int id);
	//将查询结果存在一个List中
	@Select("SELECT * FROM student")
	List<Student> select();
	
	
	@Update("UPDATE student SET name=#{name},number=#{number},sex=#{sex} WHERE id=#{id}")
	boolean update(Student student);

}
